/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package presentacion.utilidad.event_queue;

// @author Santhosh Kumar T - santhosh@in.fiorano.com

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.text.JTextComponent;

class CopyAction extends AbstractAction{
    JTextComponent comp;

    public CopyAction(JTextComponent comp){
        super("Copiar");
        this.comp = comp;
    }

    public void actionPerformed(ActionEvent e){
        comp.copy();
    }

    public boolean isEnabled(){
        return comp.isEnabled()
                && comp.getSelectedText()!=null;
    }
}